package com.heartware.sh.blackhole.ui.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;

import com.heartware.sh.blackhole.R;
import com.heartware.sh.blackhole.adapter.TabAdapter;
import com.heartware.sh.blackhole.ui.activity.base.BaseActivity;
import com.heartware.sh.blackhole.ui.fragment.MyFragment;
import com.heartware.sh.blackhole.ui.fragment.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/11/28 0028.
 */
public class TwoActivity extends BaseActivity {
    private TabLayout tabLayout;
    private ViewPager vp;


    private TabAdapter tabAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getToolBarX().setTitle(R.string.app_name).setNavigationIcon(R.mipmap.ic_launcher);
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_two;
    }

    @Override
    public void initView() {
        super.initView();


        tabLayout = (TabLayout) findViewById(R.id.tabLayout);
        vp = (ViewPager) findViewById(R.id.vp);

//        tabLayout.setTabMode(TabLayout.MODE_FIXED);

        tabAdapter = new TabAdapter(getSupportFragmentManager());
        vp.setAdapter(tabAdapter);


//        tabLayout.addTab();
//        tabLayout.setTabsFromPagerAdapter(new TabAdapter(getSupportFragmentManager(), null, mTitle));
        tabLayout.setupWithViewPager(vp);
    }


    @Override
    public void setListener() {
        super.setListener();
    }
}
